<!DOCTYPE html>
<html  lang="en">
    <head>
        <title>Document</title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    </head>
    <body>
        <div id="app">
            <navbar><button @click="isShow=!isShow">我是插槽里的按钮</button></navbar>
            <sidebar v-show="isShow"></sidebar>
        </div>

        <script>
            Vue.component("navbar",
            {
                template: 
				`<div>
					<h1>navbar</h1>
					<slot></slot>
				</div>`
            })
            Vue.component("sidebar",
            {
                template: 
				`<div>
					<h1>sidebar</h1>
				</div>`
            })
            let vm = new Vue({
                el: '#app',
                data: {
                    isShow: false,
                },
            })
        </script>
    </body>
</html>